package Demo1;

/**
 * ClassName Animal
 * Description TODO
 * Author Yanyan
 * Date 2025/11/10 21:12
 * Version 1.0
 */
public class Animal {
    public String name;
    public int age;

    static {
        System.out.println("父类的静态代码块");
    }

    {
        System.out.println("父类的实例代码块");
    }

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("父类的构造方法");
    }

    public Animal() {
    }

    public void sleep() {
        System.out.println(name + "正在睡觉");
    }

    public void eat() {
        System.out.println(name + "正在吃饭");
    }

}
